package cn.geekview.server.spring_cloud_server.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
  public Integer code;
  public String msg;
  public Object data;

  public static Result suc() {
    return new Result(1, null, null);
  }

  public static Result suc(String msg) {
    return new Result(1, msg, null);
  }

  public static Result suc(String msg, Object data) {
    return new Result(1, msg, data);
  }

  public static Result err(String msg) {
    return new Result(0, msg, null);
  }

  public static Result err() {
    return new Result(0, null, null);
  }

  public static Result suc(Object obj) {
    return new Result(1, null, obj);
  }

  public static Result noLogged() {
    return new Result(10001, "请先登录", null);
  }
}
